
//
//  MKSaveCollectionViewCell.m
//  ManKeCartoon
//
//  Created by dllo on 15/10/26.
//  Copyright © 2015年 ManKe. All rights reserved.
//

#import "MKSaveCollectionViewCell.h"
#import "MKBaseHeader.h"
@implementation MKSaveCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        _coverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height-45)];
        
        [_coverImageView setBackgroundColor:[UIColor blueColor]];
        
        [self.contentView addSubview:_coverImageView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _coverImageView.frame.size.height+5, frame.size.width, 15)];
        //[_titleLabel setBackgroundColor:[UIColor cyanColor]];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel setTextAlignment:NSTextAlignmentCenter];
        [_titleLabel setFont:[UIFont systemFontOfSize:16]];
        _pageLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _titleLabel.frame.size.height+_coverImageView.frame.size.height+5+5, frame.size.width, 15)];
        [_pageLabel setTextAlignment:NSTextAlignmentCenter];
        //[_pageLabel setBackgroundColor:[UIColor orangeColor]];
        [self.contentView addSubview:_pageLabel];
        [_pageLabel setTextColor:[UIColor grayColor]];
        [_pageLabel setFont:[UIFont systemFontOfSize:15]];
        
        _verticalLine1 = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height - 45, 1, 45)];
        [_verticalLine1 setBackgroundColor:[UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1]];
        
        _verticalLine2 = [[UIView alloc] initWithFrame:CGRectMake(frame.size.width - 1, frame.size.height - 45, 1, 45)];
        [_verticalLine2 setBackgroundColor:[UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1]];
        
        _bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height - 1, frame.size.width, 1)];
        [_bottomLine setBackgroundColor:[UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1]];
        
        [self.contentView addSubview:_verticalLine2];
        [self.contentView addSubview:_verticalLine1];
        [self.contentView addSubview:_bottomLine];

    }
    
    return self;
    
}

- (void)getDataWithModel:(MKBookModel *)model {
    
    [_coverImageView sd_setImageWithURL:[NSURL URLWithString:model.cover_url] placeholderImage:nil];
    [_titleLabel setText:model.title];
    
    [_pageLabel setText:[NSString stringWithFormat:@"%@/%@", model.page, model.lastup]];

}





@end
